package com.example.qxfw.backgroundManagement.service.impl;

import com.example.qxfw.backgroundManagement.mapper.AddressManagementMapper;
import com.example.qxfw.backgroundManagement.service.AddressManagementService;
import com.example.qxfw.common.entity.GroupInfo;
import com.example.qxfw.common.entity.Liaison;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZeLin Wang
 * @version 1.0
 * @description: 后台管理-通讯录管理
 * @date 2024/7/3 10:13
 */
@Service
public class AddressManagementServiceImpl implements AddressManagementService {

    @Autowired
    private AddressManagementMapper addressManagementMapper;

    @Override
    public List<GroupInfo> selectAllGroup() {
        return this.addressManagementMapper.selectAllGroup();
    }

    @Override
    public List<Liaison> selectAllLiaison() {
        return this.addressManagementMapper.selectAllLiaison();
    }

    @Override
    public Integer addGroupInfo(String groupName) {
        Integer idMax = this.addressManagementMapper.selectGroupIdMax()+1;
        return this.addressManagementMapper.addGroupInfo(idMax,groupName);
    }

    @Override
    public Integer deleteGroupInfo(int id) {
        return this.addressManagementMapper.deleteGroupInfo(id);
    }

    @Override
    public Integer addLiaisonInfo(Liaison liaison) {
        Integer idMax = this.addressManagementMapper.selectLiaisonIdMax()+1;
        liaison.setId(idMax);
        return this.addressManagementMapper.addLiaisonInfo(liaison);
    }

    @Override
    public Integer updateLiaisonInfo(Liaison liaison) {
        return this.addressManagementMapper.updateLiaisonInfo(liaison);
    }

    @Override
    public Integer delLiaisonInfo(int id) {
        return this.addressManagementMapper.delLiaisonInfo(id);
    }

}